package com.da.javatest.niuke.baodian;

/**
 * @author chenlida
 * @date 2020/10/12 10:49
 * https://www.nowcoder.com/practice/06f532d3230042769b4d156e963a4f4a?tpId=8&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 */
public class C55Finder {
    public int findString(String[] str, int n, String x) {
        int length = str.length;
        for (int i = 0; i < length; i++) {
            if (str[i].equals(x)) {
                return i;
            }
            if (str[length - i - 1].equals(x)) {
                return length - i - 1;
            }
        }
        return n;
    }
}
